Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9170 CTFE: Allow reinterpret casts float <-> int #1383

Conversation

donc
Copy link
Collaborator

@donc donc commented Dec 18, 2012

This a special-case extension to CTFE at Walter's request, to allow the implementation of HalfFloat to be completed. Up to now there has been no way in CTFE to peek into the raw bits of a floating-point type to extract the exponent, etc.

This adds the special case (cast(U))&e, where e is an expression
of type T, T.sizeof == U.sizeof, one type is integral (int, uint, long, ulong) and the other is floating point (float,double, ifloat, idouble).

More general situations will be added later. (Note that there is still no way to extract the components of an 80-bit real).

Only allows the special case *(cast(U*))&e, where e is an expression
of type T, T.sizeof == U.sizeof, one type is integral
(int, uint, long, ulong) and the other is floating point (float,
double, ifloat, idouble).
Purpose: allow implementation of HalfFloat.
WalterBright added a commit that referenced this pull request Dec 18, 2012
9170 CTFE: Allow reinterpret casts float <-> int
@WalterBright WalterBright merged commit ab21c35 into dlang:master Dec 18, 2012
@donc donc deleted the ctfe9170reinterpret_float_int branch July 9, 2013 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants